package com.skt.manage.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.skt.common.annotation.Log;
import com.skt.common.core.controller.BaseController;
import com.skt.common.core.domain.AjaxResult;
import com.skt.common.enums.BusinessType;
import com.skt.manage.domain.Doctorschedules;
import com.skt.manage.service.IDoctorschedulesService;
import com.skt.common.utils.poi.ExcelUtil;
import com.skt.common.core.page.TableDataInfo;

/**
 * 存储医生的排班信息Controller
 * 
 * @author ffbaby
 * @date 2025-02-20
 */
@RestController
@RequestMapping("/manage/doctorschedules")
public class DoctorschedulesController extends BaseController
{
    @Autowired
    private IDoctorschedulesService doctorschedulesService;

    /**
     * 查询存储医生的排班信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:list')")
    @GetMapping("/list")
    public TableDataInfo list(Doctorschedules doctorschedules)
    {
        startPage();
        List<Doctorschedules> list = doctorschedulesService.selectDoctorschedulesList(doctorschedules);
        return getDataTable(list);
    }

    /**
     * 导出存储医生的排班信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:export')")
    @Log(title = "存储医生的排班信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Doctorschedules doctorschedules)
    {
        List<Doctorschedules> list = doctorschedulesService.selectDoctorschedulesList(doctorschedules);
        ExcelUtil<Doctorschedules> util = new ExcelUtil<Doctorschedules>(Doctorschedules.class);
        util.exportExcel(response, list, "存储医生的排班信息数据");
    }

    /**
     * 获取存储医生的排班信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:query')")
    @GetMapping(value = "/{scheduleId}")
    public AjaxResult getInfo(@PathVariable("scheduleId") Long scheduleId)
    {
        return success(doctorschedulesService.selectDoctorschedulesByScheduleId(scheduleId));
    }

    /**
     * 新增存储医生的排班信息
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:add')")
    @Log(title = "存储医生的排班信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Doctorschedules doctorschedules)
    {
        return toAjax(doctorschedulesService.insertDoctorschedules(doctorschedules));
    }

    /**
     * 修改存储医生的排班信息
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:edit')")
    @Log(title = "存储医生的排班信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Doctorschedules doctorschedules)
    {
        return toAjax(doctorschedulesService.updateDoctorschedules(doctorschedules));
    }

    /**
     * 删除存储医生的排班信息
     */
    @PreAuthorize("@ss.hasPermi('manage:doctorschedules:remove')")
    @Log(title = "存储医生的排班信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{scheduleIds}")
    public AjaxResult remove(@PathVariable Long[] scheduleIds)
    {
        return toAjax(doctorschedulesService.deleteDoctorschedulesByScheduleIds(scheduleIds));
    }
}
